﻿using System;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Runtime;

[assembly: ExtensionApplication(typeof(ObjectArxNet.MyCommand))]
[assembly: CommandClass(typeof(ObjectArxNet.MyCommand))]

namespace ObjectArxNet
{
    public class MyCommand : IExtensionApplication
    {
        [CommandMethod("TTD")]
        public void CommandTtd()
        {
            var doc = Application.DocumentManager.MdiActiveDocument;
            var db = doc.Database;
            var ed = doc.Editor;

            var pm = PaletteManager.Current;
            var ps = pm.AddPaletteSet("面板样例");
            ps.AddPalette("图层面板", new UserControlTest());
            ps.Visible = true;

            ed.WriteMessage("\nTTD command excuted!");
        }

        public void Initialize()
        {
            var doc = Application.DocumentManager.MdiActiveDocument;
            var ed = doc.Editor;
            ed.WriteMessage("\nObjectARXNet is initialized successfully!");
        }

        public void Terminate()
        {
        }
    }
}
